package org.domain.prosoft.session;

import org.domain.prosoft.session.*;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("avisoHome")
public class AvisoHome extends EntityHome<Aviso> {

	@In(create = true)
	UsuarioHome usuarioHome;

	public void setAvisoId(Long id) {
		setId(id);
	}

	public Long getAvisoId() {
		return (Long) getId();
	}

	@Override
	protected Aviso createInstance() {
		Aviso aviso = new Aviso();
		return aviso;
	}

	public void wire() {
		getInstance();
		Usuario criador = usuarioHome.getDefinedInstance();
		if (criador != null) {
			getInstance().setCriador(criador);
		}
	}

	public boolean isWired() {
		return true;
	}

	public Aviso getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

}
